package com.pilgrim.generator.vo;

import java.util.Objects;

/**
 * BaseVO : (请描述该类).
 *
 * @author : wyb
 * @date : 2020/2/21 16:38
 */
public class BaseVO {

    /**
     * 页码
     */
    private Integer page;
    /**
     * 每页条数
     */
    private Integer num;

    public Integer getPage() {
        if (Objects.isNull(page)) {
            return Integer.valueOf(1);
        }
        return page;
    }

    public void setPage(Integer page) {
        if (Objects.isNull(page) || page < 0) {
            this.page = Integer.valueOf(0);
        } else {
            this.page = page;
        }
    }

    public Integer getNum() {
        if (Objects.isNull(num)) {
            return Integer.valueOf(0);
        }
        return num;
    }

    public void setNum(Integer num) {
        if (Objects.isNull(num) || num < 0) {
            this.num = Integer.valueOf(0);
        } else {
            this.num = num;
        }
    }

    /**
     * validate only when add
     **/
    public interface Add {
    }

    /**
     * validate only when update
     **/
    public interface Update {
    }

    @Override
    public String toString() {
        return "BaseVO{" + "page=" + page + ", num=" + num + '}';
    }
}
